<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="x-ua-compatible" content="ie=edge">

  <title>{$SETTING.website_name}</title>

  {include file="../Common/cssjs"}
  <style>
      ._selected{
        text-decoration:underline;
        color:#33C;
        font-weight:bold;
        font-size:14px;	
      }
      </style>
</head>

<body class="hold-transition sidebar-mini">
  <div class="wrapper">

    {include file="../Common/navbar"}

    {include file="../Common/sidebar"}



    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">

      <!-- Main content -->
      <div class="content">
          <div class="container-fluid">
              <div class="row">
                <!-- /.col-md-12 -->
                <div class="col-lg-12">
                  <div class="card card-primary">
                    <div class="card-header">
                      <h3 class="card-title">权限管理</h3>
                    </div>
                    <!-- /.card-header -->
                    <form action="" method="post" id="myform">
                        <input type="hidden" name="moduleid" value="{$moduleid}">
                        <input type="hidden" name="module" value="{$mod['module_en']}">
                        <table class="table table-bordered" width="100%">
                          <tr>
                            <td align="center">
                            <?php
                            foreach($module_list as $k=>$v){
                                if(!$v['is_auth']) continue;
                                
                            ?>
                            <a href="/member/authenticate?moduleid={$v.moduleid}&userid={$userid}" {if $moduleid==$v['moduleid']} class="_selected" {/if}>{$v['moduleid']} {$v['module_cn']}[{$v['module_en']}]</a>&nbsp;
                            <?php
                            }
                            ?>
                            </td>
                        
                          </tr>
                          
                          <tr>
                            <td align="center">
                            <div style="margin:0 auto;width:400px;text-align:left;">
                            <h3><span style="cursor:pointer;" onClick="javascript:$('input[name=\'access[{$mod['module_en']}][]\']').prop('checked', true);">全选</span>/<span style="cursor:pointer;" onClick="javascript:$('input[name=\'access[{$mod['module_en']}][]\']').prop('checked', false);">取消</span></h3>
                            <ol>
                            <?php
                            $md=$CORE_CONF->mod_auth($moduleid);
                            isset($checked[$mod['module_en']]) or $checked[$mod['module_en']]=array();
                            foreach($md as $kk=>$vv){
                                if(!$vv['is_auth']) continue;
                            ?>
                            <li><label><input class="big_checkbox"  {if in_array($vv['name'],$checked[$mod['module_en']]) } checked="checked" {/if} type="checkbox" name="access[{$mod['module_en']}][]" value="{$vv['name']}"> {$vv['chinese']}[{$vv['name']}]</label></li>
                            <?php
                            }
                            ?>
                            </ol>
                            
                            </div>
                            </td>
                          </tr>
                          
                          
                        <tr>
                            <td colspan="2" align="center"><input type="submit" value="提交" class="btn btn-success"></td>
                        </tr>
                        </table>
                        </form>        
                  </div>
                </div>
    
    
    
                <!-- /.col-md-12 -->
              </div>
              <!-- /.row -->
            </div><!-- /.container-fluid -->
      </div>
      <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
      <!-- Control sidebar content goes here -->
      <div class="p-3">
        <h5>Title</h5>
        <p>Sidebar content</p>
      </div>
    </aside>
    <!-- /.control-sidebar -->


    {include file="../Common/footer"}
  </div>
  
</body>

</html>